Skip to content

build: switch from prettier to 11x faster oxfmt 🚀 - #8382

Open
serhalp wants to merge 6 commits into
mainfrom
serhalp/build/oxfmt
Open

build: switch from prettier to 11x faster oxfmt 🚀#8382
serhalp wants to merge 6 commits into
mainfrom
serhalp/build/oxfmt

Conversation

@serhalp

@serhalp serhalp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

This PR moves this repo's build tooling from prettier to oxfmt. This results in an ~11x speedup of formatting.

On my Apple M3 Pro:

  • prettier --check: 3413 ms median over 5 runs
  • oxfmt --check: 304 ms median over 5 runs

Instead of porting over our exact prettier globs, this also starts formatting all oxfmt default globs, including json, toml, markdown, etc. That accounts for much of the diff in this PR.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7695c6d-cde2-4180-925e-b5a9226356a4

📥 Commits

Reviewing files that changed from the base of the PR and between f3a831f and 11e82a8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • CONTRIBUTING.md
  • package.json
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • CONTRIBUTING.md
  • package.json

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messaging when cloning encounters empty or nonstandard thrown values.
    • Clarified fallback handling in command-line error messages.
  • Chores

    • Standardized project formatting with oxfmt, replacing Prettier-based workflows.
    • Reformatted configuration, documentation, templates, styles, and test fixtures without changing behavior.
  • Documentation

    • Updated contribution guidance to reflect the new formatting workflow.
    • Reformatted project policies and development instructions for improved consistency.

Walkthrough

The repository adopts Oxfmt and replaces Prettier formatting commands and dependencies. Documentation, configuration, source, site, fixtures, tests, and TypeScript declarations are reformatted. Several nullish-coalescing fallback expressions receive explicit grouping.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: ndhoule

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the switch from Prettier to oxfmt, which is the primary change.
Description check ✅ Passed The description directly explains the migration to oxfmt, the reported speedup, and the broader formatting scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch serhalp/build/oxfmt

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 6840d95

  • Dependency count: 1,165 (no change)
  • Package size: 455 MB ⬆️ 0.00% increase vs. 6840d95
  • Number of ts-expect-error directives: 346 (no change)

Comment thread src/commands/types.d.ts
configPath?: string
siteId?: string
get id(): string | undefined
set id(id: string): void

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was invalid TypeScript, obscured by skipLibCheck: true but caught by oxfmt's parser.

// This module is "TypeScript" but contains no actual type annotations, so
// the resulting `.d.ts` file is just useless `any`s.
declare module 'lambda-local' {
declare interface Options {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was invalid TypeScript, obscured by skipLibCheck: true but caught by oxfmt's parser.

- `prettier --check`: 3413 ms median over 5 runs
- `oxfmt --check`: 304 ms median over 5 runs

Instead of porting over our exact prettier globs, this also starts formatting all oxfmt default globs, including json,
toml, markdown, etc.
Comment thread .oxfmtrc.json
"printWidth": 120,
"proseWrap": "always",
"trailingComma": "all",
"sortPackageJson": false,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could turn this one later 😁. I didn't wanna touch too many things here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be OK with enabling this one, too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do it right away in a follow-up PR.

Comment thread .oxfmtrc.json
Comment on lines +3 to +7
"semi": false,
"singleQuote": true,
"printWidth": 120,
"proseWrap": "always",
"trailingComma": "all",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to just use defaults, but this matches our Netlify code style

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer oxfmt's defaults. We don't have a very consistent style across Netlify, and this PR is already changing the style of the repository.

oxfmt's default printwidth is 100, which seems wide enough for me, but we could leave it at 120 to avoid too dramatic a diff.

@serhalp
serhalp force-pushed the serhalp/build/oxfmt branch from 5f5564a to bf51b9d Compare July 31, 2026 19:26
@serhalp
serhalp marked this pull request as ready for review July 31, 2026 19:26
@serhalp
serhalp requested review from a team as code owners July 31, 2026 19:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/PULL_REQUEST_TEMPLATE.md:
- Around line 15-17: Update the checklist text in the pull request template to
use the apostrophes in “you're” and “that's” instead of escaped backticks, and
hyphenate “incident-related.”

In `@tests/integration/__fixtures__/next-app/app/globals.css`:
- Around line 4-6: Update the --font-mono declaration to satisfy Stylelint’s
value-keyword-case rule by lowercasing the unquoted Menlo and Monaco family
names; preserve the existing font fallback order and values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0160b946-8078-4bc2-b9c1-9b1dbf7d57d6

📥 Commits

Reviewing files that changed from the base of the PR and between 6492300 and bf51b9d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (48)
  • .github/.kodiak.toml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .oxfmtrc.json
  • .prettierignore
  • .prettierrc.json
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • bin/run.js
  • functions-templates/typescript/scheduled-function/{{name}}.mts
  • layout.html
  • package.json
  • renovate.json5
  • site/netlify.toml
  • site/netlify/functions/error-reporting.ts
  • site/scripts/util/generate-command-data.js
  • site/src/content.config.ts
  • site/src/fonts/font-face.css
  • site/src/styles/custom.css
  • src/commands/clone/clone.ts
  • src/commands/types.d.ts
  • src/lib/api.ts
  • src/utils/deploy/hash-fns.ts
  • src/utils/get-repo-data.ts
  • src/utils/live-tunnel.ts
  • src/utils/shell.ts
  • tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml
  • tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html
  • tests/integration/__fixtures__/hugo-site/layouts/_default/list.html
  • tests/integration/__fixtures__/next-app-without-config/app/globals.css
  • tests/integration/__fixtures__/next-app-without-config/app/page.module.css
  • tests/integration/__fixtures__/next-app/app/globals.css
  • tests/integration/__fixtures__/next-app/app/page.module.css
  • tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml
  • tests/integration/commands/dev/redirects.test.ts
  • tests/integration/commands/env/env-get.test.ts
  • tests/integration/commands/env/env-list.test.ts
  • tests/integration/commands/env/env-set.test.ts
  • tests/integration/commands/functions-invoke/functions-invoke.test.ts
  • tests/unit/commands/database/db-migration-pull.test.ts
  • tests/unit/commands/database/db-migrations-reset.test.ts
  • tests/unit/commands/database/db-status.test.ts
  • tests/unit/commands/database/util/api-errors.test.ts
  • types/ascii-table/index.d.ts
  • types/express-logging/index.d.ts
  • types/lambda-local/index.d.ts
  • types/maxstache-stream/index.d.ts
  • types/maxstache/index.d.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
💤 Files with no reviewable changes (2)
  • .prettierrc.json
  • .prettierignore

Comment thread .github/PULL_REQUEST_TEMPLATE.md
Comment thread tests/integration/__fixtures__/next-app/app/globals.css
@serhalp
serhalp removed the request for review from a team August 5, 2026 11:18
ndhoule
ndhoule previously approved these changes Aug 7, 2026

@ndhoule ndhoule left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for taking the time to make the improvement! My only note here is that I would prefer to see us use oxfmt's defaults. We could match Prettier's current settings to minimize the diff, but I think we might as well have one big diff. (I don't think splitting formatting changes across multiple commits has much benefit--we're still taking the torch to git history either way.)

@netlify netlify deleted a comment from sirgagahandino9-design Aug 7, 2026
@serhalp
serhalp enabled auto-merge (squash) August 7, 2026 18:03
sirgagahandino9-design

This comment was marked as off-topic.

@serhalp
serhalp requested a review from ndhoule August 7, 2026 19:02
@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/netlify-cli@8382

commit: 11e82a8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants